<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<%@ page import="java.util.List"%>
<%@ page isELIgnored="false" %> <%--isELIgnored=true禁用EL表达式--%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/layui-v2.6.13/layui/css/layui.css" />
        <script type="text/javascript" src="<%=request.getContextPath() %>/layui-v2.6.13/layui/layui.js"></script>
        <script src="<%=request.getContextPath() %>/js/jquery.min-2.1.1.js"></script>
        <script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>

        <script>
            L2Dwidget.init({
                "model": {
                    "jsonPath": "https://unpkg.com/live2d-widget-model-shizuku@1.0.5/assets/shizuku.model.json",
                    "scale": 1
                },
                "display": {
                    "position": "right",
                    "width": 50,
                    "height": 100,
                    "hOffset": 0,
                    "vOffset": -20
                },
                "mobile": {
                    "show": true,
                    "scale": 0.5
                },
                "react": {
                    "opacityDefault": 0.7,
                    "opacityOnHover": 0.2
                }
            });
        </script>
		<style>
			table{
				border-collapse: collapse;/* 边框合并 */
			}
			th,td{
				border: 1px solid black;
				width: 80px;
			}
			.div1{
				margin-bottom: 20px;
			}
		</style>
	</head>
<body>
	<div style="padding: 20px;">
	    <div>
		    <div><button class="layui-btn layui-btn-primary "  onclick="getAllCheckedRefund()">一键退款</button></div>
		    <table class="layui-table">
				<colgroup>

					<col width="200">
					<col width="200">
					<col width="200">
					<col width="200">
					<col width="200">
					<col width="200">
					<col>
				</colgroup>
				<thead>
					<tr>
						<th><input type="checkbox" onclick="checkAll(this)" /></th>
						<th>订单号</th>
						<th>用户id</th>
						<th>用户名</th>
						<th>交易金额</th>
						<th>交易时间</th>
						<th>订单状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
                    <c:forEach items="${list}" var="obj">
                        <tr>
                            <td><input type="checkbox" name="k" value="${obj.orderNo}"></td>
                            <td>${obj.orderNo}</td>
                            <td>${obj.uId}</td>
                            <td>${obj.uName}</td>
                            <td>${obj.orderMoney}</td>
                            <td>${obj.createTime}</td>
                            <td>
                                <c:if test="${obj.orderStatus==5}">退款中</c:if>
                                <c:if test="${obj.orderStatus==6}">已退款</c:if>
                            </td>
                            <td><a href="/order/refund?orderNo=${obj.orderNo}">退款</a></td>
                        </tr>
                    </c:forEach>
				</tbody>
			</table>
		</div>

	</div>
</body>
<script>
    function checkAll(obj){
        var a = $(obj).prop("checked");
        if(a){
            $(":checkbox[name='k']").prop("checked", true);
        } else {
            $(":checkbox[name='k']").prop("checked", false);
        }
    }

     function getAllCheckedRefund(){
        var es = $(":checkbox[name='k']:checked");
        var params = "";
        $.each(es, function(index, item){
            console.info(item.value);
            params+=item.value+",";
        })
        console.info(params.substr(0, params.length-1));
        window.location.href="/order/refund?orderNo="+params.substr(0, params.length-1);

    }
</script>
</html>